package com.gxa.saas.portal.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.gxa.saas.core.entity.dto.luoj.ProductDTO;
import com.gxa.saas.core.entity.dto.luoj.ShoppingCart;
import io.swagger.models.auth.In;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotNull;
import java.util.List;

public interface ShoppingCartService extends IService<ShoppingCart> {

    /*
    * 添加商品，默认每次新增一个
    * */
    void addProduct(@Validated ProductDTO product);

    /*
    * 查询购物车
    * */
    ShoppingCart getShoppingCart(@Validated @NotNull(message = "用户id不能为null")Integer userId);

    /*
    * 删除购物车中商品，默认每次删除一个
    * */
    Integer delProductForShoppingCart(@NotNull(message = "用户id不能为null")Integer userId,
                                      @NotNull(message = "商品id不能为null")Integer pid);

    /*
    * 结算购物车
    * */
    Boolean buyShoppingCart(ShoppingCart shoppingCart);

    /*
    * 移除购物车
    * */
    Integer removeProduct(Integer userId);
}
